package com.storage.system.service.impl;

import com.alibaba.fastjson.JSON;
import com.storage.system.domain.StorageGoods;
import com.storage.system.domain.StorageProcurementOrder;
import com.storage.system.domain.StorageProduct;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * @author hzhang7
 * @date 2019/9/7 6:42 PM
 */
public class Test {

    public static void main(String[] args) {
        List<StorageProduct> storageProducts = new ArrayList<>();

        StorageProduct product = new StorageProduct();
        product.setId(1L);
        product.setProductName("三叶草");
        product.setProductSpuCode("ABCDEF");
        product.setBrandId(1L);
        product.setBrandName("阿迪阿斯");
        product.setCategoryId(1L);
        product.setCategoryName("鞋子");
        product.setNewProduct(0);
        product.setTotalGoodsNum(60L);

        List<StorageGoods> goods = new ArrayList<>();
        StorageGoods goodsOne = new StorageGoods();
        goodsOne.setId(9L);
        goodsOne.setProductId(1L);
        goodsOne.setGoodsCode("ABCDEF001");
        goodsOne.setStockNum(30L);
        goodsOne.setPurchasePrice(new BigDecimal(100));
        goodsOne.setTradePrice(new BigDecimal(90));
        goodsOne.setRetailPrice(new BigDecimal(110));
        goodsOne.setPropertiesDetail("[{\"尺码\":\"33码\"}]");
        goods.add(goodsOne);

        StorageGoods goodsTwo = new StorageGoods();
        goodsTwo.setId(10L);
        goodsTwo.setProductId(1L);
        goodsTwo.setGoodsCode("ABCDEF002");
        goodsTwo.setStockNum(30L);
        goodsTwo.setPurchasePrice(new BigDecimal(100));
        goodsTwo.setTradePrice(new BigDecimal(90));
        goodsTwo.setRetailPrice(new BigDecimal(110));
        goodsTwo.setPropertiesDetail("[{\"propertiesName\":\"尺码\"},{\"propertiesValue\":\"34码\"}]");
        goods.add(goodsTwo);

        product.setGoods(goods);
        storageProducts.add(product);

        String goodsJson = JSON.toJSONString(storageProducts);

        StorageProcurementOrder order = new StorageProcurementOrder();
        order.setOrderTitle("阿迪达斯鞋子采购");
        order.setOrderTotalPrice(new BigDecimal(6000));
        order.setProvideUserId(7L);
        order.setOrderType(0);
        order.setDescription("采购潮流三叶草跑鞋");
        order.setGoodsContent(goodsJson);

        String orderJson = JSON.toJSONString(order);


        System.out.println(orderJson);
    }
}
